 
GO

/****** Object:  Table [dbo].[EmployeeTimeSheetTable]    Script Date: 07/05/2012 17:04:14 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[EmployeeTimeSheetTable](
	[EmployeeTimeSheetKey] [bigint] IDENTITY(1,1) NOT NULL,
	[EmployeeProfileKey] [int] NOT NULL,
	[UserAccountKey] [int] NOT NULL,
	[DayCode][smallint] NOT NULL,
	[TimeIn] [datetime] NOT NULL,
	[TimeOut] [datetime] NULL,
	[Remarks] [nvarchar](400) NULL,
	[TimeSheetStatus] [bit] NULL,
	[Status] [smallint] NULL,
	[CreatedDateTime] [datetime] NULL,
	[ModifiedDateTime] [datetime] NULL,
 CONSTRAINT [PK_dTimeSheets] PRIMARY KEY CLUSTERED 
(
	[EmployeeTimeSheetKey] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable]  WITH NOCHECK ADD  CONSTRAINT [FK_EmployeeTimeSheetTable_EmployeeProfileTable] FOREIGN KEY([EmployeeProfileKey])
REFERENCES [dbo].[EmployeeProfileTable] ([EmployeeProfileKey])
NOT FOR REPLICATION 
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable] CHECK CONSTRAINT [FK_EmployeeTimeSheetTable_EmployeeProfileTable]
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable]  WITH CHECK ADD  CONSTRAINT [FK_EmployeeTimeSheetTable_UserAccountTable] FOREIGN KEY([UserAccountKey])
REFERENCES [dbo].[UserAccountTable] ([UserAccountKey])
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable] CHECK CONSTRAINT [FK_EmployeeTimeSheetTable_UserAccountTable]
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable]  WITH CHECK ADD  CONSTRAINT [FK_EmployeeTimeSheetTable_DayCodeTable] FOREIGN KEY([DayCode])
REFERENCES [dbo].[DayCodeTable] ([DayCode])
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable] CHECK CONSTRAINT [FK_EmployeeTimeSheetTable_DayCodeTable]
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable] ADD  CONSTRAINT [DF_EmployeeTimeSheetTable_CreatedDateTime]  DEFAULT (getdate()) FOR [CreatedDateTime]
GO

ALTER TABLE [dbo].[EmployeeTimeSheetTable] ADD  CONSTRAINT [DF_EmployeeTimeSheetTable_ModifiedDateTime]  DEFAULT (getdate()) FOR [ModifiedDateTime]
GO


